from total_calc import Score

class SortScore(Score):
    def sort(self, sortBy):
        i = 0
        while i < len(self._score):
            j = i+1
            while j < len(self._score):
                if self._score[j][sortBy] > self._score[i][sortBy]:
                    x = self._score[i]
                    self._score[i] = self._score[j]
                    self._score[j] = x
                j += 1

            i += 1
        pass

if __name__ == "__main__":
    objScore = SortScore("data_68.txt")
    objScore.calc_total()
    objScore.sort("total")
    objScore.show()
    objScore.save("data_sorted.txt")